using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using System.Windows.Forms;

namespace Dogfight2008.Tests
{
  [TestFixture]
  public class DogfightStateMachineFixture
  {
    InGameStateFixture.MockGame CreateGame()
    {
      return new InGameStateFixture.MockGame();
    }

    [Test]
    public void Constr()
    {
      InGameStateFixture.MockGame game = CreateGame();
      DogfightStateMachine s = new DogfightStateMachine(game);
    }

    [Test]
    public void StartInPressFireState()
    {
      DogfightStateMachine s = new DogfightStateMachine(CreateGame());
      Assert.AreEqual(DFState.PressFire, s.CurrentState);
    }

    [Test]
    public void PressingFireChangesState()
    {
      DogfightStateMachine s = new DogfightStateMachine(CreateGame());
      s.KeyDown(Keys.Space);
      Assert.AreEqual(DFState.InGame, s.CurrentState);
    }

    [Test]
    public void PressFireThenGameOver()
    {
      InGameStateFixture.MockGame game = CreateGame();
      DogfightStateMachine s = new DogfightStateMachine(game);
      s.KeyDown(Keys.Space);
      game.SetGameOver();
      s.Tick(1);
      Assert.AreEqual(DFState.GameOver, s.CurrentState);
    }
  }
}
